<?php
function smarty_modifier_str_emoticon($str)
{
	$str = htmlspecialchars_decode($str); 	
	$str = str_replace(array("\r\n", "\n", "\r"), '<br/>', $str);
	$str = preg_replace("/(<br\s*\/?>\s*)+/", "<br/>", $str);
	$arrEmoticon = Vfriend_Function::replaceEmoticon();
	$arrSearch = array_keys($arrEmoticon);
	foreach ($arrEmoticon as $icon => $value) {
		$arrSearch[]	= $icon;
		$arrReplace[] 	= '<img border="0" src="' . $value['image'] . '" title="' . $value['title'] . '" alt="" />';
	}
	$str = str_replace($arrSearch, $arrReplace, $str);
	return $str;
}
?>
